import { request } from "@/utils/request";
let userinfo = JSON.parse(sessionStorage.getItem('userInfo'))
let userId = ''
let organizationId = 0;
if (userinfo) {
    organizationId = userinfo.tenantId
    userId = userinfo.loginName
}
export const api = {
  downPlanTemplate: "/deliver/Windchill/servlet/rest/hzero/pmgt/plan/downPlanTemplate",
  importOtherProjectPIPlan: "/deliver/Windchill/servlet/rest/hzero/pmgt/plan/importOtherProjectPIPlan",
  importPIPlanActivities: "/deliver/Windchill/servlet/rest/hzero/pmgt/plan/importPIPlanActivities",
  summaryDeliverabes: "/deliver/Windchill/servlet/rest/hzero/pmgt/deliverable/summaryDeliverabes",
  getFolderTree: "/deliver/Windchill/servlet/rest/hzero/pdm/folder/getFolderTree",
  getSubTypes: "/project/Windchill/servlet/rest/hzero/pdm/attribute/getSubTypes",
  noticeUser: "/project/Windchill/servlet/rest/hzero/pdm/core/noticeUser"
};
// http://pdmlink.sany.com.cn:80/Windchill/servlet/rest/hzero/pdm/core/noticeUser
// 导出
export function downPlanTemplate(parameter) {
  return request({
    url: api.downPlanTemplate,
    method: 'post',
    data: parameter,
    responseType: 'blob' //服务器返回的数据类型
  })
}
// 导入已有项目计划
export function importOtherProjectPIPlan(parameter) {
  return request({
    url: api.importOtherProjectPIPlan,
    method: 'post',
    data: parameter
  })
}
// 线下模板导入
export function importPIPlanActivities(parameter) {
  return request({
    url: api.importPIPlanActivities,
    method: 'post',
    data: parameter
  })
}
// 汇总交付物
export function summaryDeliverabes(parameter) {
  return request({
    url: api.summaryDeliverabes,
    method: 'post',
    data: parameter
  })
}
export function uploadCommon(url, parameter) {
  return request({
    url: url,
    method: 'post',
    data: parameter
  })
}
// 获取自动发布设置
export function getPushTaskSet(parameter) {
  return request({
    url: `/indv/v1/${organizationId}/task-publish-days/oid?oid=${parameter.oid}`,
    method: 'get',
  })
}
// 保存自动发布设置
// /indv/v1/0/task-publish-days
export function setPushTaskSet(parameter) {
  return request({
    url: `/indv/v1/${organizationId}/task-publish-days`,
    method: 'put',
    data: parameter
  })
}
// 文件存放位置
export function getFolderTree(parameter) {
  return request({
    url: api.getFolderTree,
    method: 'post',
    data: parameter
  })
}
// 文件类型
export function getSubTypes(parameter) {
  return request({
    url: api.getSubTypes,
    method: 'post',
    data: parameter
  })
}
// 催办
export function noticeUser(parameter) {
  return request({
    url: api.noticeUser,
    method: 'post',
    data: parameter
  })
}